<?php 

//include_once ('smf_1-1_api.php');
/*
if (isset($_POST['submit'])) { // Handle the form.
	if (smf_setLoginCookie(3600, $_POST['username'], $_POST['password'], false)){
	
		if (smf_authenticateUser()){
			$status = 1;
		} else {
			$status = 2;
		}
	} else {
		$status = 3;
	}
} else {
	if (smf_authenticateUser()){
		$status = 1;
	} else {
		$status = 2;
	}
}*/

$status = 2;

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="jscript/animatedcollapse.js"></script>
<script type="text/javascript">
	animatedcollapse.addDiv('widget0')	/* Seasonal Schedule */
	animatedcollapse.addDiv('widget1')	/* Subscriptions */
	animatedcollapse.addDiv('widget2')	/* Images */
	animatedcollapse.addDiv('n1')	/* Recent Topics */
	animatedcollapse.addDiv('n2')
	animatedcollapse.addDiv('n3')
	animatedcollapse.addDiv('n4')
	animatedcollapse.addDiv('n5')
	
	animatedcollapse.init()
</script>

</head>

<body onLoad="getIt();">
<script language="JavaScript" type="text/JavaScript">
function getBrowserWindowSize()
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' )
	{
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
	}

return {width:myWidth, height:myHeight};
}

function getIt(){
var browserWindowSize = getBrowserWindowSize();
	if ( browserWindowSize.width > 1024 ) {
		changecss('.widget_Head','width','450px');
		changecss('.widget_Foot','width','450px');
		changecss('.widget_Wrap','width','433px');
		changecss('.widget_Main a','margin-left','10px');
	}
}

function changecss(theClass,element,value) {
	//Last Updated on June 23, 2009
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
var cssRules;

var added = false;
	for (var S = 0; S < document.styleSheets.length; S++){
	
		if (document.styleSheets[S]['rules']) {
		  cssRules = 'rules';
		 } else if (document.styleSheets[S]['cssRules']) {
		  cssRules = 'cssRules';
		 } else {
		  //no rules found... browser unknown
		 }
	
		  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
			   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
					if(document.styleSheets[S][cssRules][R].style[element]){
						document.styleSheets[S][cssRules][R].style[element] = value;
						added=true;
						break;
					}
			   }
		  }
		  
		  if(!added){
			if(document.styleSheets[S].insertRule){
				  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
			} else if (document.styleSheets[S].addRule) {
					document.styleSheets[S].addRule(theClass,element+': '+value+';');
			}
		  }
	}
}
</script>
	<!-- header starts here -->
<div id="header">
  <div id="header-content"> 
    <ul>
      <li><a href="admin/login/">Login</a></li>
    </ul>
  </div>
</div>

<div id="content-wrap">
	
	<div id="nav">
		<img src="images/Nav_Head.png" alt="navigation header" class="no-border" />
		<a href="http://www.nocturnalgenesis.net/FSU/LIS4368/final/review"><img src="images/Home_On.png" alt="home" class="no-border" /></a>
		<a href="review/reviews/default/0/A"><img src="images/Reviews_Off.png" alt="reviews" class="no-border" /></a>
		<img src="images/Nav3.png" alt="nav3" class="no-border" />
	</div>
		
	<div id="main">	
			
		<div id="mogulus">
		<script src="http://static.mogulus.com/scripts/playerv2.js?channel=weeabooreview&layout=playerEmbedDefault&backgroundColor=0x000000&backgroundAlpha=1&backgroundGradientStrength=0&chromeColor=0x000000&headerBarGlossEnabled=false&controlBarGlossEnabled=false&chatInputGlossEnabled=false&uiWhite=true&uiAlpha=0.5&uiSelectedAlpha=0.7&dropShadowEnabled=false&dropShadowHorizontalDistance=10&dropShadowVerticalDistance=10&paddingLeft=0&paddingRight=0&paddingTop=0&paddingBottom=0&cornerRadius=0&backToDirectoryURL=null&bannerURL=null&bannerText=null&bannerWidth=320&bannerHeight=50&showViewers=true&embedEnabled=true&chatEnabled=false&onDemandEnabled=true&programGuideEnabled=false&fullScreenEnabled=true&reportAbuseEnabled=false&gridEnabled=false&initialIsOn=true&initialIsMute=false&initialVolume=10&contentId=null&initThumbUrl=null&playeraspectwidth=16&playeraspectheight=9&mogulusLogoEnabled=true&width=850&height=553&wmode=window" type="text/javascript"></script>
		</div>
		<div id="home_content">
            <div id="topiclist">
                <?php 
					$cnt = 1;
					$url = 'test';
					foreach($recent as $row) {
						$title = htmlspecialchars($row->title);
						$snip = strip_tags(substr($row->content,0,250));
						
						echo "<h1><a href=\"review/article/$row->p_id\" onmouseover=\"javascript:animatedcollapse.toggle('n$cnt')\"><span class=\"frontnews\">$row->class:</span> $title @ $row->posted</a></h1>
						<div id=\"n$cnt\" ><p>$snip...</p></div>";
						$cnt++;
					}
				?>
            </div>
            <div id="smflogin">
                <div class="widget_Head">
                    <div class="widget_TL"></div>
                    <div class="widget_TR"></div>
                </div>
                <div class="widget_Wrap">
                    <div class="widget_Main">
	
		<?php switch($status){
				case 1: echo "<p>Welcome back, " . $smf_user_info['username'] . ".</p>";
						require_once ('widget_schedule.php');
						break;
				case 2: echo "<!--<p>Authentication Failed.</p>-->
						<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">
						
						<p><b>Username:</b><br /><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"20\" value=\""; if (isset($_POST['username'])) echo $_POST['username'];
						echo"\" /></p>
						
						<p><b>Password:</b><br /><input type=\"password\" name=\"password\" size=\"20\" maxlength=\"20\" /></p><br />
						
						<div align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Login\" /></div>
						
						</form><!-- End of Form -->";
						break;
				case 3: echo "<!--<p>Set Login Cookie failure.</p>-->
						<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">
						
						<p><b>Username:</b><br /><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"20\" value=\""; if (isset($_POST['username'])) echo $_POST['username'];
						echo"\" /></p>
						
						<p><b>Password:</b><br /><input type=\"password\" name=\"password\" size=\"20\" maxlength=\"20\" /></p><br />
						
						<div align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Login\" /></div>
						
						</form><!-- End of Form -->";
						break;				
				default: echo"<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">
							
							<p><b>Username:</b><br /><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"20\" value=\""; if (isset($_POST['username'])) echo $_POST['username'];
							echo"\" /></p>
							
							<p><b>Username:</b><br /><input type=\"password\" name=\"password\" size=\"20\" maxlength=\"20\" /></p><br />
							
							<div align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Login\" /></div>
							
							</form><!-- End of Form -->";
			} ?>
                </div>
            </div>
            <div class="widget_Foot"><div class="widget_BL"></div><div class="widget_BR"></div></div> 		
            </div>
        </div>
		<div id="footer"><p>&copy;2010 Kevin Baumgardner</p></div>
	</div>
</div>
</body>
</html>
